# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[ActionItem.__init__(self, name, type_, action=self.remove_demo_mode)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb77047ac>}
nname: 0
n 0(None)[user_config['advanced']['demo_mode'] = False
user_config['advanced']['start_on_demo_mode'] = False
user_config.save()
pygui_globs['menustack'].back_to_home()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7704c4c>}
nname: 6
n 6(None)[def __init__(self, name, type_='setupitem'):
	ActionItem.__init__(self, name, type_, action=self.remove_demo_mode)

def remove_demo_mode(self):
	user_config['advanced']['demo_mode'] = False
	user_config['advanced']['start_on_demo_mode'] = False
	user_config.save()
	pygui_globs['menustack'].back_to_home()

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb770420c>}
nname: 0
n 0(None)[ActionItem.__init__(self, name, type_, action=self.demo_mode)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7704a2c>}
nname: 113
n 113(None)[]:
	i: 3(), 99(), 111(AE)
	o: 

nname: 111
n 111(None)[]:
	i: 89(f)
	o: 113(AE)

nname: 99
n 99(None)[print 'DEMO EVENT DROPPED'
]:
	i: 89(t)
	o: 113()

nname: 89
n 89(<dummy_ex3> EXC_MATCH Full)[]:
	i: 0(except)
	o: 99(t), 111(f)

nname: 3
n 3(None)[self.ks.set_key(str(key))
Task(self.ks.set_key, '').start(2)
event_map[key].post(dict(count=1, timeout=timeout))
]:
	i: 0(try)
	o: 113()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 89(except)

nname: 89
n 89(None)[except Full:
	print 'DEMO EVENT DROPPED'
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	self.ks.set_key(str(key))
	Task(self.ks.set_key, '').start(2)
	event_map[key].post(dict(count=1, timeout=timeout))
]:
	i: 
	o: 89()

nname: 0
n 0(None)[try:
	self.ks.set_key(str(key))
	Task(self.ks.set_key, '').start(2)
	event_map[key].post(dict(count=1, timeout=timeout))
except Full:
	print 'DEMO EVENT DROPPED'
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7713d8c>}
nname: 193
n 193(None)[self.ks.show()
def _post_event(key, timeout=None):
	try:
		self.ks.set_key(str(key))
		Task(self.ks.set_key, '').start(2)
		event_map[key].post(dict(count=1, timeout=timeout))
	except Full:
		print 'DEMO EVENT DROPPED'

self.event_player = EventPlayer(_post_event, '/etc/params/demo.replay', loop=True)
self.event_player.start()
pygui_globs['demomode'] = self
return None
]:
	i: 146(), 183()
	o: 

nname: 183
n 183(None)[print 'DEMO DOES NOT SUPPORT UNIVERSE_SWITCHER FOR NOW !!!'
return None
]:
	i: 0(f)
	o: 193()

nname: 146
n 146(None)[stack.back_to_menu(home_menu)
home_menu.select(m.choices[0])
]:
	i: 0(t)
	o: 193()

nname: 0
n 0(home_menu)[from pygui.input.interface import EventPlayer
from pygui.eventmanager import event_map
from Queue import Full
from pygui.window import KeystrokeWindow
config.resume_video = False
config.resume_dvd = False
self.ks = KeystrokeWindow()
user_config['advanced']['start_on_demo_mode'] = True
user_config.save()
stack = pygui_globs['menustack']
home_menu = stack.get_home()
]:
	i: 
	o: 146(t), 183(f)

nname: 0
n 0(None)[from pygui.input.interface import EventPlayer
from pygui.eventmanager import event_map
from Queue import Full
from pygui.window import KeystrokeWindow
config.resume_video = False
config.resume_dvd = False
self.ks = KeystrokeWindow()
user_config['advanced']['start_on_demo_mode'] = True
user_config.save()
stack = pygui_globs['menustack']
home_menu = stack.get_home()
if home_menu:
	stack.back_to_menu(home_menu)
	home_menu.select(m.choices[0])
else:
	print 'DEMO DOES NOT SUPPORT UNIVERSE_SWITCHER FOR NOW !!!'
	return None
self.ks.show()
def _post_event(key, timeout=None):
	try:
		self.ks.set_key(str(key))
		Task(self.ks.set_key, '').start(2)
		event_map[key].post(dict(count=1, timeout=timeout))
	except Full:
		print 'DEMO EVENT DROPPED'

self.event_player = EventPlayer(_post_event, '/etc/params/demo.replay', loop=True)
self.event_player.start()
pygui_globs['demomode'] = self
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb770956c>}
nname: 0
n 0(None)[self.ks.hide()
self.event_player.stop()
pygui_globs['demomode'] = None
pygui_globs['menustack'].back_to_home()
config.resume_video = True
config.resume_dvd = True
user_config['advanced']['start_on_demo_mode'] = False
user_config.save()
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7704c2c>}
nname: 6
n 6(None)[def __init__(self, name, type_='setupitem'):
	ActionItem.__init__(self, name, type_, action=self.demo_mode)

def demo_mode(self):
	from pygui.input.interface import EventPlayer
	from pygui.eventmanager import event_map
	from Queue import Full
	from pygui.window import KeystrokeWindow
	config.resume_video = False
	config.resume_dvd = False
	self.ks = KeystrokeWindow()
	user_config['advanced']['start_on_demo_mode'] = True
	user_config.save()
	stack = pygui_globs['menustack']
	home_menu = stack.get_home()
	if home_menu:
		stack.back_to_menu(home_menu)
		home_menu.select(m.choices[0])
	else:
		print 'DEMO DOES NOT SUPPORT UNIVERSE_SWITCHER FOR NOW !!!'
		return None
	self.ks.show()
	def _post_event(key, timeout=None):
		try:
			self.ks.set_key(str(key))
			Task(self.ks.set_key, '').start(2)
			event_map[key].post(dict(count=1, timeout=timeout))
		except Full:
			print 'DEMO EVENT DROPPED'

	self.event_player = EventPlayer(_post_event, '/etc/params/demo.replay', loop=True)
	self.event_player.start()
	pygui_globs['demomode'] = self
	return None

def stop(self):
	self.ks.hide()
	self.event_player.stop()
	pygui_globs['demomode'] = None
	pygui_globs['menustack'].back_to_home()
	config.resume_video = True
	config.resume_dvd = True
	user_config['advanced']['start_on_demo_mode'] = False
	user_config.save()
	return None

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb77042ac>}
nname: 0
n 0(None)[from __future__ import absolute_import
from ...core import ActionItem
from peewee.notifier import Task
from pygui.shared import pygui_globs
from pygui.config import user_config
class DeleteDemoItem(ActionItem):
	def __init__(self, name, type_='setupitem'):
		ActionItem.__init__(self, name, type_, action=self.remove_demo_mode)

	def remove_demo_mode(self):
		user_config['advanced']['demo_mode'] = False
		user_config['advanced']['start_on_demo_mode'] = False
		user_config.save()
		pygui_globs['menustack'].back_to_home()



class LaunchDemoItem(ActionItem):
	def __init__(self, name, type_='setupitem'):
		ActionItem.__init__(self, name, type_, action=self.demo_mode)

	def demo_mode(self):
		from pygui.input.interface import EventPlayer
		from pygui.eventmanager import event_map
		from Queue import Full
		from pygui.window import KeystrokeWindow
		config.resume_video = False
		config.resume_dvd = False
		self.ks = KeystrokeWindow()
		user_config['advanced']['start_on_demo_mode'] = True
		user_config.save()
		stack = pygui_globs['menustack']
		home_menu = stack.get_home()
		if home_menu:
			stack.back_to_menu(home_menu)
			home_menu.select(m.choices[0])
		else:
			print 'DEMO DOES NOT SUPPORT UNIVERSE_SWITCHER FOR NOW !!!'
			return None
		self.ks.show()
		def _post_event(key, timeout=None):
			try:
				self.ks.set_key(str(key))
				Task(self.ks.set_key, '').start(2)
				event_map[key].post(dict(count=1, timeout=timeout))
			except Full:
				print 'DEMO EVENT DROPPED'

		self.event_player = EventPlayer(_post_event, '/etc/params/demo.replay', loop=True)
		self.event_player.start()
		pygui_globs['demomode'] = self
		return None

	def stop(self):
		self.ks.hide()
		self.event_player.stop()
		pygui_globs['demomode'] = None
		pygui_globs['menustack'].back_to_home()
		config.resume_video = True
		config.resume_dvd = True
		user_config['advanced']['start_on_demo_mode'] = False
		user_config.save()
		return None



import pygui.config as config
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76fd5ec>}
from __future__ import absolute_import
from ...core import ActionItem
from peewee.notifier import Task
from pygui.shared import pygui_globs
from pygui.config import user_config
class DeleteDemoItem(ActionItem):
	def __init__(self, name, type_='setupitem'):
		ActionItem.__init__(self, name, type_, action=self.remove_demo_mode)

	def remove_demo_mode(self):
		user_config['advanced']['demo_mode'] = False
		user_config['advanced']['start_on_demo_mode'] = False
		user_config.save()
		pygui_globs['menustack'].back_to_home()



class LaunchDemoItem(ActionItem):
	def __init__(self, name, type_='setupitem'):
		ActionItem.__init__(self, name, type_, action=self.demo_mode)

	def demo_mode(self):
		from pygui.input.interface import EventPlayer
		from pygui.eventmanager import event_map
		from Queue import Full
		from pygui.window import KeystrokeWindow
		config.resume_video = False
		config.resume_dvd = False
		self.ks = KeystrokeWindow()
		user_config['advanced']['start_on_demo_mode'] = True
		user_config.save()
		stack = pygui_globs['menustack']
		home_menu = stack.get_home()
		if home_menu:
			stack.back_to_menu(home_menu)
			home_menu.select(m.choices[0])
		else:
			print 'DEMO DOES NOT SUPPORT UNIVERSE_SWITCHER FOR NOW !!!'
			return None
		self.ks.show()
		def _post_event(key, timeout=None):
			try:
				self.ks.set_key(str(key))
				Task(self.ks.set_key, '').start(2)
				event_map[key].post(dict(count=1, timeout=timeout))
			except Full:
				print 'DEMO EVENT DROPPED'

		self.event_player = EventPlayer(_post_event, '/etc/params/demo.replay', loop=True)
		self.event_player.start()
		pygui_globs['demomode'] = self
		return None

	def stop(self):
		self.ks.hide()
		self.event_player.stop()
		pygui_globs['demomode'] = None
		pygui_globs['menustack'].back_to_home()
		config.resume_video = True
		config.resume_dvd = True
		user_config['advanced']['start_on_demo_mode'] = False
		user_config.save()
		return None



import pygui.config as config
